--[[信息：
	账号坐骑共享
	添加日期：2019-08-11
	功能：共享账号下所有角色的法术
]]--
print(">>Script: player Log Message.")

local function checkSpells (event,player)
		local spells={458,459,468,470,471,472,578,579,580,581,3363,5784,6648,6653,6654,6777,6896,6897,6898,6899,8394,8395,8980,10789,10793,
		10795,10796,10798,10799,10873,10969,13819,15779,15780,15781,16055,16056,16058,16059,16060,16080,16081,16082,16083,16084,17229,17450,
		17453,17454,17455,17456,17458,17459,17460,17461,17462,17463,17464,17465,17481,18363,18989,18990,18991,18992,22717,22718,22719,22720,
		22721,22722,22723,22724,23161,23214,23219,23220,23221,23222,23223,23225,23227,23228,23229,23238,23239,23240,23241,23242,23243,23246,
		23247,23248,23249,23250,23251,23252,23338,23509,23510,24242,24252,25953,26054,26055,26056,26656,28828,29059,30174,32235,32239,32240,
		32242,32243,32244,32245,32246,32289,32290,32292,32295,32296,32297,32345,33630,33660,34406,34407,34767,34769,34790,34795,34896,34897,
		34898,34899,35018,35020,35022,35025,35027,35028,35710,35711,35712,35713,35714,36702,37015,39315,39316,39317,39318,39319,39798,39800,
		39801,39802,39803,40192,41252,41513,41514,41515,41516,41517,41518,42776,42777,43688,43810,43899,43900,43927,44151,44153,44317,44744,
		46197,46199,46628,47037,48025,48027,48778,48954,49193,49322,49378,49379,50869,50870,51412,51960,54729,54753,55531,58615,58983,59567,
		59568,59569,59570,59571,59572,59573,59650,59785,59788,59791,59793,59797,59799,59802,59804,59961,59976,59996,60002,60021,60024,60025,
		60114,60116,60118,60119,60136,60140,60424,61229,61230,61294,61309,61425,61442,61444,61446,61447,61451,61465,61467,61469,61470,61996,
		61997,62048,63232,63635,63636,63637,63638,63639,63640,63641,63642,63643,63796,63844,63956,63963,64656,64657,64658,64659,64731,64927,
		64977,65439,65637,65638,65639,65640,65641,65642,65643,65644,65645,65646,65917,66087,66088,66090,66091,66122,66123,66124,66846,66847,
		66906,66907,67336,67466,68056,68057,68187,68188,69395,71342,71810,33388,33391,34090,34091,54197
		} --可以账号共享的法术ID
		local character_number = CharDBQuery("select guid from characters where account = "..player:GetAccountId()..";") --获取玩家账号下所有角色的guid	
		local character_count = character_number:GetRowCount() --获取账号下一个有多少个月色
		if character_number then
			repeat
			
				local character_spells = CharDBQuery("select spell from character_spell where guid="..character_number:GetUInt32(0)..";") --一个角色所有的法术ID
					if character_spells then
						repeat
						for i=0, #spells do
							if(character_spells:GetUInt32(0)==spells[i]) --判断其它角色是否有可以共享的法术ID
								then if(player:HasSpell(spells[i])~=true)
										then player:LearnSpell(spells[i])
											
									 end
							end
						end
						until not character_spells:NextRow()	
					end
				until not character_number:NextRow()
		end
end
--PLAYER_EVENT_ON_LOGIN                   =     3        -- (event, player)
	RegisterPlayerEvent(3, checkSpells) --登录
